<template>
  <div id="app">
    <h2>App</h2>
    <!-- 
      Vue3中要绑定原生事件, 子组件中不要声明, 且事件名是DOM事件名
      事件绑定在子组件的根标签
     -->
    <Child @click="fn2" @test="fn"/>
  </div>
</template>

<script lang="ts" setup>
import Child from './Child.vue'

const fn = (e: any) => {
      console.log('fn()', e)
}

const fn2 =  (e: Event) => {
      console.log(e.target)  // 发生事件的目标元素
      console.log(e.currentTarget) // 绑定事件的目标元素
}
</script>

